package cbModel;


import java.util.ArrayList;

import javax.swing.ComboBoxModel;
import javax.swing.event.ListDataListener;

import daoDataFactory.DaoFactory;
import domijn.Menu;
import pnlBeheer.PnlGDBeheer;


public class CBMMenu implements ComboBoxModel<Menu>{

	@SuppressWarnings("unused")
	private PnlGDBeheer pnlGDBeheer;
	private Menu menu;
	private ArrayList<Menu>arr;

	public CBMMenu(PnlGDBeheer pnlGDBeheer) {
		this.pnlGDBeheer = pnlGDBeheer;
		arr = DaoFactory.getwokapplicatie().getDaoIMenu().loadall();
                //TODO FireChanged
	
	}
	
	/**
	 * 
	 * @param setArray hier mee word de lijst met gegevens geset in de combobox menu
	 */
	public void setArray(ArrayList<Menu> arr) {
		this.arr = arr;
		
	}

	@Override
	public Menu getElementAt(int i) {
		return arr.get(i);
	}

	@Override
	public int getSize() {
		return arr.size();
	}

	@Override
	public Object getSelectedItem() {
		return menu;
	}

	@Override
	public void setSelectedItem(Object o) {
		menu = (Menu)o; 
	}
	
	
	@Override
	public void addListDataListener(ListDataListener arg0) {
		// TODO Auto-generated method stub
	}
	
	@Override
	public void removeListDataListener(ListDataListener arg0) {
		// TODO Auto-generated method stub
	}

	
}
